<?php

class SFC_Error
{
	private static $instance;
	
	private function __construct() {}

	public static function singleton()
	{
		if (!isset(self::$instance)) {
			$c = __CLASS__;
			self::$instance = new $c;
		}
			return self::$instance;
	}
	
	public function setX($x)
	{
	$this->x = $x;
	}
	
	public function getX()
	{
	return $this->x;
	}	
}

class SFC_Display
{
	public function __construct()
	{
		$this->e = SFC_Error::singleton();
	}
	
	function getXfromE()
	{
		return $this->e->getX();
	}
}

$e = SFC_Error::singleton();
$d = new SFC_Display();

$e->setX('Hi ');
echo $d->getXfromE();
$e->setX('World');
echo $d->getXfromE();

?>